﻿using HCQ2_IBLL;
using HCQ2_Model.DocModel.APIModel;
using HCQ2_Model.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HCQ2_BLL
{
    public partial class T_DocEmpowerBLL: IT_DocEmpowerBLL
    {
        /// <summary>
        ///  获取文档授权列表
        /// </summary>
        /// <param name="powerName"></param>
        /// <param name="startDate"></param>
        /// <param name="endDate"></param>
        /// <param name="powerStatus"></param>
        /// <param name="page"></param>
        /// <param name="rows"></param>
        /// <returns></returns>
        public TableModel GetPowerListData(string powerName, string startDate, string endDate, int powerStatus, int page, int rows)
        {
            return new TableModel
            {
                rows = DBSession.IT_DocEmpowerDAL.GetPowerListData(powerName, startDate, endDate, powerStatus, page, rows),
                total = DBSession.IT_DocEmpowerDAL.GetPowerDataCount(powerName, startDate, endDate, powerStatus, page, rows)
            };
        }

        //**********************************************************接口**********************************************************
        /// <summary>
        ///  判断用户是否授权
        /// </summary>
        /// <param name="user_id"></param>
        /// <returns></returns>
        public bool GetPowerCountByUser(int user_id)
        {
            return DBSession.IT_DocEmpowerDAL.GetPowerCountByUser(user_id);
        }
        /// <summary>
        ///  接口获取授权列表
        /// </summary>
        /// <param name="param">参数</param>
        /// <param name="user_id">用户id</param>
        /// <returns></returns>
        public TableModel GetPowerAPPList(EmpowerAPPParam param, int user_id)
        {
            return new TableModel
            {
                rows = DBSession.IT_DocEmpowerDAL.GetPowerAPPList(param, user_id),
                total = DBSession.IT_DocEmpowerDAL.GetPowerAPPCount(param, user_id)
            };
        }
    }
}
